/**
 * @param {number} x
 * @return {boolean}
 */
var isPalindrome = function(x) {
    if(x<0){
        return false
    }
      if(x<10){
        return true
    }
    dummyNum=x
    let arr=[]
    while(dummyNum>=1){
        arr.push(dummyNum%10)
        dummyNum=Math.floor(dummyNum/10)
    }
   
    let leftIndex=0 ,rightIndex=arr.length-1
    let isValid=true
    for(;leftIndex<rightIndex;leftIndex++,rightIndex--){
        isValid=arr[leftIndex]===arr[rightIndex]
        if(!isValid){
            return isValid
        }
    }
    
    

    return isValid
};
console.log(isPalindrome(10));